{extend name="default/base/base_seller" /}
{block name="seller_main"}

<div class="alert mt10">
    <ul class="mt5">
        <li>{$Think.lang.area_instructions1}</li>
        <li>{$Think.lang.area_instructions2}</li>
        <li>{$Think.lang.area_instructions3}</li>
        <li>{$Think.lang.area_instructions4}</li>
    </ul>
</div>
<form method="get"  target="_self">
    <table class="search-form">
        <tr>
            <td class="tr">
                <div class="fr">
                    <input type="submit" class="submit" value="{$Think.lang.ds_common_search}" />
                </div>
                <div class="fr">
                    <div class="fl" style="margin-right:3px;">
                        <select name="search_type" id="search_type" class="querySelect">
                            <option value="day" {$Request.param.search_type=='day'?'selected':''}>{$Think.lang.day_statistics}</option>
                            <option value="week" {$Request.param.search_type=='week'?'selected':''}>{$Think.lang.weekly_statistics}</option>
                            <option value="month" {$Request.param.search_type=='month'?'selected':''}>{$Think.lang.monthly_statistics}</option>
                        </select>
                    </div>
                    <div id="searchtype_day" style="display:none;" class="fl">
                        <input type="text" class="text w70" name="search_time" id="search_time" value="{:date('Y-m-d',$search_arr.day.search_time)}" />
                        <label class="add-on"><i class="iconfont">&#xe8d6;</i></label>
                    </div>
                    <div id="searchtype_week" style="display:none;" class="fl">
                        <select name="searchweek_year" class="querySelect">
                            {foreach name="year_arr" item="v"}
                            <option value="{$key}" {$search_arr.week.current_year == $key ?'selected':''}>{$v}</option>
                            {/foreach}
                        </select>
                        <select name="searchweek_month" class="querySelect">
                            {foreach name="month_arr" item="v"}
                            <option value="{$key}" {$search_arr.week.current_month == $key ?'selected':''}>{$v}</option>
                            {/foreach}
                        </select>
                        <select name="searchweek_week" class="querySelect">
                            {foreach name="week_arr" item="v"}
                            <option value="{$v.key}" {$search_arr.week.current_week == $v.key ?'selected':''}>{$v.val}</option>
                            {/foreach}
                        </select>
                    </div>
                    <div id="searchtype_month" style="display:none;" class="fl">
                        <select name="searchmonth_year" class="querySelect">
                            {foreach name="year_arr" item="v"}
                            <option value="{$key}" {$search_arr.month.current_year == $key ?'selected':''}>{$v}</option>
                            {/foreach}
                        </select>
                        <select name="searchmonth_month" class="querySelect">
                            {foreach name="month_arr" item="v"}
                            <option value="{$key}" {$search_arr.month.current_month == $key ?'selected':''}>{$v}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
            </td>
        </tr>
    </table>
</form>

<div id="stat_tabs" class="ui-tabs" style="min-height:500px;padding-top:10px;">
    <div class="tabmenu">
        <ul class="tab pngFix">
            <li><a href="#membernum_div" ds_type="showdata" data-param='{"type":"membernum"}'>{$Think.lang.number_members_placed}</a></li>
            <li><a href="#orderamount_div" ds_type="showdata" data-param='{"type":"orderamount"}'>{$Think.lang.place_order_amount}</a></li>
            <li><a href="#ordernum_div" ds_type="showdata" data-param='{"type":"ordernum"}'>{$Think.lang.order_quantity}</a></li>
        </ul>
    </div>
  <!-- 下单会员数 -->
    <div id="membernum_div" ds_type="datacontainer" class="tc">
      {if $stat_json_map}
      <div class="stat-map-color">{$Think.lang.high}&nbsp;&nbsp;<span style="background-color: #fd0b07;">&nbsp;</span>
        <span style="background-color: #ff9191;">&nbsp;</span><span style="background-color: #f7ba17;">&nbsp;</span><span style="background-color: #fef406;">&nbsp;</span><span style="background-color: #25aae2;">&nbsp;</span>&nbsp;&nbsp;{$Think.lang.low}
    		<p>{$Think.lang.ranking_interpretation_information}</p>
    	</div>
        <div id="map_membernum" style="width:400px; height:400px; float:left;"></div>
        <div id="bar_membernum" style="width:500px; height:400px; float:left;"></div>
      {else /}
      <div class="warning-option"><i class="iconfont">&#xe64c;</i><span>{$Think.lang.there_qualified_data_record}</span></div>
      {/if}
    </div>
  <!-- 下单金额 -->
    <div id="orderamount_div" ds_type="datacontainer" class="tc" style="display:none;">
      {if $stat_json_map}
      <div class="stat-map-color">{$Think.lang.high}&nbsp;&nbsp;<span style="background-color: #fd0b07;">&nbsp;</span><span style="background-color: #ff9191;">&nbsp;</span><span style="background-color: #f7ba17;">&nbsp;</span><span style="background-color: #fef406;">&nbsp;</span><span style="background-color: #25aae2;">&nbsp;</span>&nbsp;&nbsp;{$Think.lang.low}
    		<p>{$Think.lang.ranking_interpretation_information}</p>
    	</div>
        <div id="map_orderamount" style="width:400px; height:400px; float:left;"></div>
        <div id="bar_orderamount" style="width:500px; height:400px; float:left;"></div>
      {else /}
      <div class="warning-option"><i class="iconfont">&#xe64c;</i><span>{$Think.lang.there_qualified_data_record}</span></div>
     {/if}
    </div>
  <!-- 下单量 -->
    <div id="ordernum_div" ds_type="datacontainer" class="tc" style="display:none;">
      {if $stat_json_map}
      <div class="stat-map-color">{$Think.lang.high}&nbsp;&nbsp;<span style="background-color: #fd0b07;">&nbsp;</span><span style="background-color: #ff9191;">&nbsp;</span><span style="background-color: #f7ba17;">&nbsp;</span><span style="background-color: #fef406;">&nbsp;</span><span style="background-color: #25aae2;">&nbsp;</span>&nbsp;&nbsp;{$Think.lang.low}
    		<p>{$Think.lang.ranking_interpretation_information}</p>
    	</div>
        <div id="map_ordernum" style="width:400px; height:400px; float:left;"></div>
        <div id="bar_ordernum" style="width:500px; height:400px; float:left;"></div>
      {else /}
      <div class="warning-option"><i class="iconfont">&#xe64c;</i><span>{$Think.lang.there_qualified_data_record}</span></div>
      {/if}
    </div>
</div>

<div id="statlist" class=""></div>

<script src="{$Think.PLUGINS_SITE_ROOT}/statistics.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/highcharts/highcharts.js"></script>
<link rel="stylesheet" type="text/css" href="{$Think.PLUGINS_SITE_ROOT}/map/jquery.vector-map.css">
<script src="{$Think.PLUGINS_SITE_ROOT}/map/jquery.vector-map.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/map/china-zh.js"></script>
<script type="text/javascript">
//展示搜索时间框
function show_searchtime(){
    s_type = $("#search_type").val();
    $("[id^='searchtype_']").hide();
    $("#searchtype_"+s_type).show();
}

$(function(){
    //切换登录卡
    $('#stat_tabs').tabs();

    //统计数据类型
    var s_type = $("#search_type").val();
    $('#search_time').datepicker({dateFormat: 'yy-mm-dd'});

    show_searchtime();
    $("#search_type").change(function(){
        show_searchtime();
    });

    //更新周数组
    $("[name='searchweek_month']").change(function(){
        var year = $("[name='searchweek_year']").val();
        var month = $("[name='searchweek_month']").val();
        $("[name='searchweek_week']").html('');
        $.getJSON(HOMESITEURL+'/Index/getweekofmonth.html',{y:year,m:month},function(data){
            if(data != null){
                for(var i = 0; i < data.length; i++) {
                    $("[name='searchweek_week']").append('<option value="'+data[i].key+'">'+data[i].val+'</option>');
                }
            }
        });
    });
    {if $stat_json_map}
        getMap({$stat_json_map.membernum},'map_membernum');
        getMap({$stat_json_map.orderamount},'map_orderamount');
        getMap({$stat_json_map.ordernum},'map_ordernum');

        $('#bar_membernum').highcharts({$stat_json_bar.membernum});
        $('#bar_orderamount').highcharts({$stat_json_bar.orderamount});
        $('#bar_ordernum').highcharts({$stat_json_bar.ordernum});
    {/if}
});
</script>

{/block}
